package com.mrjy.integral.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.HappinessInfo;
import com.mrjy.integral.bo.IHappinessInfoBo;

@Controller
@RequestMapping("integral/happinessInfo")
public class HappinessInfoController{
	@Resource
	private IHappinessInfoBo happinessInfoBo;
    private Integer userId;
    private String wish;
    private String familyPic;

    /**
     * 添加
     * @return
	 */
	@RequestMapping("/add")
	@ResponseBody
	public Object add(HappinessInfo info){
		return happinessInfoBo.txInsert(info);
	}
	/**
	 * 根据ID查询
	 * @return
	 */
	@RequestMapping("/queryById")	
	@ResponseBody
	public Object queryById(int schoolId) {
		return happinessInfoBo.queryById(schoolId);
	}
	/**
	 * 修改
	 * @param userInfo
	 * @return
	 */
	@RequestMapping("/edit")
	@ResponseBody
	public Object edit(HappinessInfo info) {		
		return happinessInfoBo.txUpdateById(info);
	}
	
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {		
		return happinessInfoBo.deleteByIds(ids);
	}
	/**
	 * 禁用、起用
	 * @param ids
	 * @return
	 */
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(HappinessInfo info) {		
		return happinessInfoBo.updateDisableFlag(info);
	}
	
	/**
	 * 通过userId幸福树主页的数据
	 * @param info
	 * @return
	 */
	@RequestMapping("/queryIndexInfoByUserId")
	@ResponseBody
	public Object queryIndexInfoByUserId(HappinessInfo info) {		
		return happinessInfoBo.queryIndexInfoByUserId(info);
	}
	/**
	 * 通过userId在学幸福树主页的数据
	 * @param info
	 * @return
	 */
	@RequestMapping("/queryHappyTreeInfoByUserId")
	@ResponseBody
	public Object queryHappyTreeInfoByUserId(HappinessInfo info) {		
		return happinessInfoBo.queryHappyTreeInfoByUserId(info);
	}
	/**
	 * 通过userId在学幸福树主页的数据
	 * @param info
	 * @return
	 */
	@RequestMapping("/queryHappyRoadInfoByUserId")
	@ResponseBody
	public Object queryHappyRoadInfoByUserId(HappinessInfo info) {		
		return happinessInfoBo.queryHappyRoadInfoByUserId(info);
	}
	/**
	 * 通过userId查询用户的幸福值
	 * @param info
	 * @return
	 */
	@RequestMapping("/queryHappySocureByUserId")
	@ResponseBody
	public Object queryHappySocureByUserId(HappinessInfo info) {		
		return happinessInfoBo.queryHappySocureByUserId(info);
	}
	/**
	 * 通过userId和typeId 更新收集状态（收集爱心接口）
	 * @param info
	 * @return
	 */
	@RequestMapping("/collectLove")
	@ResponseBody
	public Object collectLove(HappinessInfo info) {		
		return happinessInfoBo.txCollectLove(info);
	}
	
	/**
	 * 通过userId和typeId 更新收集状态（收集爱心接口）
	 * @param info
	 * @return
	 */
	@RequestMapping("/makeWish")
	@ResponseBody
    public Object makeWish(Integer userId, String wish, String familyPic) {
        return happinessInfoBo.txMakeWish(userId, wish, familyPic);
    }

}
